﻿using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Volo.Abp.ObjectMapping;

namespace Rechargeable.Users
{
    public class UserAppService : IdentityUserAppService, IUserAppService
    {
        private readonly IdentityUserManager _userManager;
        private readonly IIdentityUserRepository _userRepository;

        public UserAppService(
            IdentityUserManager userManager,
            IIdentityUserRepository userRepository, IIdentityRoleRepository roleRepository, IOptions<Microsoft.AspNetCore.Identity.IdentityOptions> identityOptions) : base(userManager, userRepository,roleRepository,identityOptions)
        {
            _userManager = userManager;
            _userRepository = userRepository;
        }

        public async Task<List<IdentityUserDto>> GetAllUsersAsync()
        {
            return ObjectMapper.Map<List<IdentityUser>, List<IdentityUserDto>>((await _userRepository.GetListAsync()));
        }
    }
}
